package com.Ajava1704.for设计模式.for观察者模式;

import java.util.Vector;

/**
 * @类名: com.Ajava1704.for设计模式.for观察者模式
 * @作者: lgt
 * @创建时间: 2020-02-15 17:01
 * @描述:
 **/
public class ForBeiGuanChaZheAbstract implements ForBeiGuanChaZheInterface {

    private Vector<ForGuanChaZheInterface> vector = new Vector<>();

    @Override
    public void register(ForGuanChaZheInterface forGuanChaZheInterface) {
        vector.add(forGuanChaZheInterface);
    }

    @Override
    public void del(ForGuanChaZheInterface forGuanChaZheInterface) {
        vector.remove(forGuanChaZheInterface);
    }

    @Override
    public void tongzhi() {
        vector.forEach(forGuanChaZheInterface -> forGuanChaZheInterface.chuli());
    }

    @Override
    public void test() {

    }
}
